package sanshi.contect.observer.v2;

/**
 * 面向对象的思想
 */
public class Child {
    //cry表示孩子哭不哭。false：表示不哭。
    public boolean cry = false;

    public boolean isCry(){
        return cry;
    }

    /**
     * 醒了之后就哭了
     */
    public void wakeUp(){
        System.out.println("wuwwuwuuwuw......");
        cry = true;
    }

    public static void main(String[] args) {
        Child child = new Child();
        while (!child.cry){
            try {
                Thread.sleep(1000);
                child.wakeUp();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("abserver.......");
        }
    }
}
